<!DOCTYPE html>
<html>

	<head>
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link href="../common/mui/mui.min.css" rel="stylesheet" />
		<link href="../common/css/publicStyle.css" rel="stylesheet" />
		<link href="../common/css/iconfont0.css" rel="stylesheet" />
		<meta charset="UTF-8">
		<title></title>
		<style>
			html,
			body {
				background-color: #FBFBFB;
			}
			
			.mui-content {
				/*background: url(../images/bgimage.png) no-repeat 0px 0px;*/
				margin-top: 44px;
				/*padding-bottom: -40px;*/
				width: 100%;
				background-size: 100% auto;
				-moz-background-size: 100% 100%;
				-webkit-background-size: 100% 100%;
				background-color: #FBFBFB;
			}
			.msgTitle {
				width: calc(100% - 40px);
				font-size: 15px;
				margin: 0px 20px;
				margin-top: 10px;
				color: #323232;
				font-weight: 500;
				/*text-align: center;*/
			}
			.msgAuthor {
				font-weight: 400;
				/*color: rgba(1, 1, 1, .5);*/
				color: gray;
				font-size: 13px;
				width: 90%;
				margin: 5px auto;
				margin-right: 5%;
				text-align: right;
			}
			
			.newsContent {
				font-size: 14px;
				font-weight: 400;
				color: #515151;
				margin: 0 auto;
				width: 90%;
				text-indent: calc(10px);
				line-height: 25px;
				word-wrap: break-word;
				background: #F9F9F9;
				padding: 10px 10px 20px 10px;
				border-radius: 5px;
				border: 1px #323232 dashed;
			}
			
			.mui-pull-caption {
				font-size: 14px;
				font-weight: 300;
			}
			
			.endDIv {
				margin: 20px;
				text-align: center;
				font-size: 15px;
				font-style: oblique;
				color: grey;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<div id="navimg"><img src="../common/images/logo-white.png" width="130px" height="20px"></div>
		</header>
		<div class="mui-content">
			<div class="mui-scroll-wrapper">
				<div class="mui-scroll">
					<div class="msgTitle"></div>
					<div class="msgAuthor"></div>
					<div class="newsContent"></div>
					<div class="endDIv">--- END ---</div>
				</div>
			</div>
		</div>
	</body>
	<script src="../common/mui/mui.min.js"></script>
	<script type="text/javascript">
		mui.init({
			swipeBack: true //启用右滑关闭功能
		});
		mui.plusReady(function() {
			//				plus.navigator.setStatusBarBackground('white');
			//				plus.navigator.setStatusBarStyle('dark');

			mui('.mui-scroll-wrapper').scroll({
				bounce: true,
				indicators: false, //是否显示滚动条
			});

			var self = plus.webview.currentWebview();
			var newsData = self.newsData;
			var titleStr = specialReplace(newsData.title);
			var timeStr = newsData.publishTime;
			timeStr = timeStr.replace('+', ' ');
			var authorStr = specialReplace(newsData.author);
			authorStr = authorStr + " " + timeStr;
			var contentStr = specialReplace(newsData.content);

			var msgTitle = document.querySelector('.msgTitle');
			msgTitle.innerHTML = titleStr;
			var msgAuthor = document.querySelector('.msgAuthor');
			msgAuthor.innerHTML = authorStr;
			var muiContent = document.querySelector('.mui-content');
			muiContent.style.height = window.screen.height - 64 + 'px';

			var scrollWrapper = document.querySelector('.mui-scroll-wrapper');
			scrollWrapper.style.height = window.screen.height - 60 + 'px';
			scrollWrapper.style.marginTop = 40 + 'px';
			var newsContent = document.querySelector('.newsContent');
			newsContent.innerHTML = contentStr;
			var orientation = window.orientation;
			if(orientation == 90 || orientation == -90) {
				if(plus.os.name == 'iOS') {
					scrollWrapper.style.height = window.screen.width - 120 + 'px';
					scrollWrapper.style.marginTop = 60 + 'px';
					muiContent.style.height = window.screen.width - 64 + 'px';
				} else {
					scrollWrapper.style.height = window.screen.height - 120 + 'px';
					scrollWrapper.style.marginTop = 60 + 'px';
				}
			}
		});

		function specialReplace(str) {
			var newStr = str.replace(/@and@/g, '&');
			newStr = newStr.replace(/@nbsp@/g, '&nbsp'); //<br>
			newStr = newStr.replace(/@br@/g, '<br>');
			newStr = newStr.replace(/@《@/g, '<');
			newStr = newStr.replace(/@jianhao@/g, '^');
			return newStr;
		}

		window.addEventListener('orientationchange', function() {
			var orientation = window.orientation;
			var scrollWrapper = document.querySelector('.mui-scroll-wrapper');
			var muiContent = document.querySelector('.mui-content');

			var clientHeight = window.screen.height - 160;
			var contentHeight = window.screen.height - 160;
			scrollWrapper.style.marginTop = 75 + 'px';

			if(orientation == 90 || orientation == -90) { //横屏
				clientHeight = window.screen.width - 120;
				scrollWrapper.style.marginTop = 60 + 'px';
				contentHeight = window.screen.width;
				if(window.screen.width > window.screen.height) { //安卓横屏
					clientHeight = window.screen.height - 120;
					contentHeight = window.screen.height
				}
			} else {
				clientHeight = window.screen.height - 160;
				contentHeight = window.screen.height
			}
			scrollWrapper.style.height = clientHeight + 'px';
			muiContent.style.height = contentHeight - 64 + 'px';

		}, false);
	</script>

</html>